package com.musemun.service.function.functionimpl;

import com.musemun.service.function.CrifoIn;
import com.musemun.util.ExcelUtil;
import com.musemun.util.UploadFileUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.concurrent.ExecutorService;

/**
 * @description:
        文物出库类
 * @author winner
 * @date 2020/4/19
 */
@Service
public class CrifoInImpl implements CrifoIn {

    @Resource
    ExecutorService executorService;
    /**
     * 调用excelListener的监听器
     *
     * @param inputStream excel的输入流
     * @return void
     */
    @Override
    public void ExcelUpload(InputStream inputStream){
        ExcelUtil.ExcelUpload(inputStream);
    }
    /**
     *   传入图片文件，读入数据库
     * @param file  图片的文件
     * @return list<Crifo>
     */
    @Override
    public void photoInsert(MultipartFile[] file,List<String> fileList) {
        executorService.execute(()-> {
            try {
                UploadFileUtils.upload("img",file,fileList);
            } catch (IOException e) {
                e.printStackTrace();
            }
        });

    }
}
